#include "Shared.h"

sampler2D unit0 : register( s0 );
sampler2D unit1 : register( s1 );

void vsFunction(in vsGeometryIn vertex, out vsGeometryOut result)
{
	result.position0 = mul(vertex.position0, World);
	result.positionSys = mul(result.position0, View);
	result.positionSys = mul(result.positionSys, Projection);
	
	result.normal0 = mul(vertex.normal0, (float3x3)World);
	result.color0 = 1.0f;
	result.uv0 = vertex.uv0;
	result.uv1 = vertex.uv1;
	//result.uv1 = -result.uv1;
}


void psFunction(in psGeometryIn pixel, out float4 color : COLOR0)
{
	
	color = tex2D(unit1, pixel.uv0) * saturate( tex2D(unit0, pixel.uv1) );
	
	
	color+= tex2D(unit1, pixel.uv0) * saturate( tex2D(unit1, pixel.uv0) - .4 );
	
}

technique t0
{
    pass p0
    {
		VertexShader = compile vs_2_0 vsFunction();
		PixelShader = compile ps_2_0 psFunction();
    }
}
